package it.koutifaris.travianmap.content;

import it.koutifaris.travianmap.db.TMapDomain;
import it.koutifaris.travianmap.db.impl.TMapDbOpenHelper;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;

//INSERT INTO `x_world` VALUES (401,x,y,3,99090,'Nome villo',816,'Nome Pg',424,'Nome ally',51);

public class TRavianMapProvider extends ContentProvider {

	/**
	 * Code to match for the all data query
	 */
	private static final int VILLAGES = 1;

	private static final UriMatcher uriMatcher;
	private TMapDbOpenHelper dbHelper;

	static {
		uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);

		uriMatcher.addURI(TMapDomain.AUTHORITY, "villages", VILLAGES);
	}

	@Override
	public boolean onCreate() {
		dbHelper = new TMapDbOpenHelper(getContext());
		return true;
	}

	@Override
	public int delete(Uri uri, String where, String[] whereArgs) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String getType(Uri uri) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Uri insert(Uri uri, ContentValues values) {
		int match = uriMatcher.match(uri);
		switch (match) {
		case VILLAGES:

			break;

		default:
			throw new IllegalArgumentException("Unknown URI " + uri);
		}

		return null;
	}

	@Override
	public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
		// TODO Auto-generated method stub
		return 0;
	}

}
